package com.byd.huawei.mes.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;

@RestController
@RequestMapping("/hw/ems")
public class BodyController {
    @RequestMapping(value = "/info.do", method = RequestMethod.POST)
    public String sayHello(HttpServletRequest request, HttpServletResponse response) throws IOException {
        StringBuilder reqBody = new StringBuilder();
        String line = null;
        BufferedReader reader = request.getReader();
        while ((line = reader.readLine()) != null) {
            reqBody.append(line);
        }
        return reqBody.toString();
    }
}
